package com.lc.protocol;

/**
 * Created by zhyioo on 2017/6/14.
 */

public class TransmitHandlerInvoker implements ITransmitHandler {
    protected ITransmitHandler _activeHandler = null;

    public void setHandler(ITransmitHandler dev) {
        _activeHandler = dev;
    }

    @Override
    public boolean OnWrite(byte[] data, int datalen, int timeoutMs) {
        if (_activeHandler == null)
            return false;
        return _activeHandler.OnWrite(data, datalen, timeoutMs);
    }

    @Override
    public boolean OnRead(byte[] data, int[] datalen, int timeoutMs) {
        if (_activeHandler == null)
            return false;
        return _activeHandler.OnRead(data, datalen, timeoutMs);
    }
}
